package ShareLife.gar;

import com.activity.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class ListItemAdapter extends BaseAdapter {

	Context mContext;
	String listItemArray[];
	String listItemContent[];
	public ListItemAdapter(Context aContext)
	{
		mContext = aContext;
		
	}
	public int getCount() {
		// TODO Auto-generated method stub
		return listItemArray.length;
	}

	public void setItem(String itemTitle[],String itemContent[])
	{
		listItemArray = itemTitle;
		listItemContent = itemContent;
	}
	public Object getItem(int arg0) {
		
		return arg0;
	}

	public long getItemId(int arg0) {
		
		return arg0;
	}

	public View getView(int arg0, View arg1, ViewGroup arg2) {
		RelativeLayout listitem = null;
		TextView firstLine = null;
		TextView secondLine = null;
		if (arg1== null) {
			LayoutInflater factory = LayoutInflater.from(mContext);
			listitem = (RelativeLayout)factory.inflate(R.layout.list_item, null);	
		} else {
			
			listitem = (RelativeLayout) arg1;
		}
		firstLine = (TextView)listitem.findViewById(R.id.contactlistitem_firstLine);
		secondLine = (TextView)listitem.findViewById(R.id.contactlistitem_secondLine);
		firstLine.setText(listItemArray[arg0]);
		secondLine.setText(listItemContent[arg0]);
		return listitem;
	}
	
	

}
